package com.csw.compose

import android.app.Application
import android.util.Log
import android.widget.Toast

class App : Application() {

    companion object {
        private lateinit var INSTANCE: Application
        private var APP_SHORT_TOAST: Toast? = null
            get() {
                field?.cancel()
                field = Toast.makeText(
                    INSTANCE,
                    "",
                    Toast.LENGTH_SHORT
                )
                return field
            }
        val SHOW_APP_TOAST: (String) -> Unit = {
            Log.d("Toast", it)
            APP_SHORT_TOAST?.apply {
                setText(it)
                show()
            }
        }
    }

    override fun onCreate() {
        super.onCreate()
        INSTANCE = this
    }

}